﻿using System;
using System.Collections.Generic;
using Speed.Data;

namespace ContractManager.BLL.Business
{
    public static class ClsRoleForms
    {
        public static List<Entity.RoleForms> SelectAll()
        {
            using (var db = Sys.NewDb())
            {
                return Data.Base.RoleForms.Select(db);
            }
            
        }

        public static void Insert(Entity.RoleForms capital)
        {
            using (var db = Sys.NewDb())
            {
                db.Insert<Entity.RoleForms>(capital, EnumSaveMode.Requery);
            }
            
        }

        public static void Update(Entity.RoleForms capital)
        {
            using (var db = Sys.NewDb())
            {
                db.Update<Entity.RoleForms>(capital);
            }
            
        }

        public static Entity.RoleForms SelectByPk(Int32 roleFormId)
        {
            using (var db = Sys.NewDb())
            {
                return db.SelectSingle<Entity.RoleForms>(string.Format("RoleNo={0}", roleFormId));
            }
            
        }

        public static int DeleteByPk(Int32 roleFormId)
        {
            using (var db = Sys.NewDb())
            {
                return db.Delete<Entity.RoleForms>(string.Format("RoleNo={0}", roleFormId));
            }
            
        }

        public static int DeleteByRole(Int32 roleId)
        {
            using (var db = Sys.NewDb())
            {
                return db.Delete<Entity.RoleForms>(string.Format("RoleNo={0}", roleId));
            }
            
        }
    }
}
